﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OPDNPayDateEditEasyUI.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.ProdModel.OPDNPayDateEditEasyUI" %>
<%--原材料货款支付--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>原材料货款支付</title>
    <link rel="stylesheet" type="text/css" href="../EasyUI/themes/default/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="../EasyUI/themes/icon.css" />
	<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>   
	<script type="text/javascript" src="../EasyUI/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../EasyUI/datagrid-detailview.js"></script>
    <script type="text/javascript" src="../EasyUI/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="../EasyUI/easyui-formatter_20140718.js"></script>
    <script>
        
         ///自适应宽高
       $(window).resize(function(){		    
             $("#tab_list").datagrid({
                    width: '100%',
                    height: $(parent.document).find(".tabsPageContent").height() - 11 > 0 ? $(parent.document).find(".tabsPageContent").height() - 11 : 500,
             }); 
	    });

        var lastIndex;
         $(document).ready(function () {
          //加载数据
            InitGird();           
        })
        //加载列表数据
        function InitGird() {
            $('#tab_list').datagrid({               
                url: location.href, //请求数据的页面
                sortName: 'TaxDate', //排序字段
                sortOrder: 'desc', //排序类型
                idField: 'DocEntry', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度    
                height: $(parent.document).find(".tabsPageContent").height() - 11 > 0 ? $(parent.document).find(".tabsPageContent").height() - 11 : 500,
                nowrap: true, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                singleSelect: true, //是否只能选中一条
                remoteSort: true, //定义是否从服务器给数据排序                
                columns: [[
                    { title: '收货单号', field: 'DocNum', width: 90},
                    { title: '供应商', field: 'CardName', width: 100 },
                    { title: '总金额', field: 'DocTotal', width: 70,formatter:milliformatter },
                    { title: '收货日期', field: 'TaxDate', width: 100,formatter:formatterdate },
                    { title: '支付日期', field: 'U_PayDate', width: 100,
                    editor:{
                            type:'datebox',
                            options:{
                                formatter:function(date){var y = date.getFullYear();var m = date.getMonth()+1;var d = date.getDate();return y+'-'+m+'-'+d;}
                            }
                            }
                    },
                    { title: '供应商参考号', field: 'NumAtCard', width: 80},
                    { title: '注释', field: 'Comments', width: 150}                   
                ]],
                toolbar: "#tab_toolbar",
                queryParams: { "action": "query" },
                pagination: false, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: <%=numPerPage %>, //默认一页数据条数
                pageList:<%=SetnumPerPage() %>,
                rownumbers: true, //行号
                showFooter: false,
                view: detailview,  
                detailFormatter:function(index,row){  
                    return '<div class="ddv"></div>';  
                },  
                onExpandRow: function(index,row){  
                    var ddv = $(this).datagrid('getRowDetail',index).find('div.ddv');  
                    ddv.panel({  
                        border:false,  
                        cache:true,  
                        href:'OPDNPayDateEditGetById.aspx?action=getbyid&DocEntry='+row.DocEntry,  
                        onLoad:function(){  
                            $('#tab_list').datagrid('fixDetailRowHeight',index);  
                            $('#tab_list').datagrid('selectRow',index);  
                            $('#tab_list').datagrid('getRowDetail',index).find('form').form('load',row);  
                        }  
                    });  
                    $('#tab_list').datagrid('fixDetailRowHeight',index);  
                },
                onClickRow:function(rowIndex){
					if (lastIndex != rowIndex){
						$('#tab_list').datagrid('endEdit', lastIndex);
						$('#tab_list').datagrid('beginEdit', rowIndex);
					}
					lastIndex = rowIndex;
				},
                onAfterEdit:function(rowIndex, rowData, changes)
                {
                    rowData.action = "editrow";
                    $.post(location.href, rowData, function (data) {
                        if(data!="成功")
                            $.messager.alert('提示', data, 'info', function () { });
                    });
                }
            });
        }         
    </script>
</head>
<body style="margin:2px;" >
    <div id="tab_list"></div>
     <div id="tab_toolbar" style="padding:2px;">
       <a href="#" title="高级查找" class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="return　onAdjSearch(this);" Permission="">高级查找</a>
     </div>

</body>
</html>
